
import axios from 'axios';

/**
 * 材料类别
 */
export class MaterialCategoryService {
    // 分页查询列表
    static findMaterialCategorys (queryParams) {
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategorys',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的材料类别
    static findMaterialCategory (materialCategoryId) {
        const query = {
            materialCategoryId
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategory',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料类别(包含外键名称)
    static findMaterialCategoryForView (materialCategoryId) {
        const query = {
            materialCategoryId
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategoryForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料类别(包含外键名称)
    static findMaterialCategoryForEdit (materialCategoryId) {
        const query = {
            materialCategoryId
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategoryForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的材料类别(只提取ID 和 Name)
    static findMaterialCategorysWithIdNameById (materialCategoryId) {
        const query = {
            materialCategoryId
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategorysWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询材料类别集合(只提取ID 和 Name)
    static findMaterialCategorysWithIdNameByName (materialCategoryName) {
        const query = {
            materialCategoryName
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/findMaterialCategorysWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存材料类别
    static saveMaterialCategory (materialCategory) {
        const query = {}
        return axios({
            url: '/restaurant/material/MaterialCategory/saveMaterialCategory',
            method: 'POST',
            params: query,
            data: materialCategory
        });
    }

    //修改保存材料类别
    static updateMaterialCategory (materialCategory) {
        const query = {}
        return axios({
            url: '/restaurant/material/MaterialCategory/updateMaterialCategory',
            method: 'POST',
            params: query,
            data: materialCategory
        });
    }

    //根据ID查询指定的材料类别(只提取ID 和 Name)
    static deleteMaterialCategory (materialCategoryId) {
        const query = {
            materialCategoryId
        }
        return axios({
            url: '/restaurant/material/MaterialCategory/deleteMaterialCategory',
            method: 'POST',
            params: query,
        });
    }
}
